import React, { Component } from 'react';   
import { Icon } from 'antd';
import "./rade.scss"; 

class RateComponent extends Component {
  constructor(props){
  	super(props);
  	this.state={
        newIcon:["1","1","1","1","1"]
  	}
  }
  componentWillMount(){
		let newArr = this.state.newIcon,
		    that   = this;
	  
		for ( let i = 0 ; i < Number(that.props.defaultValue) ; i++ ) {
			setTimeout(()=>{
				newArr[i]="2"
				that.setState({
							  newIcon:newArr
				})
			},400*i)
		}
	  
  }
  render() {    
    return (
      <div className="radeConainer">
		{
			this.state.newIcon.map((item,index)=>{
				return (<div className={item==="1"?'coloe1':'color2'} key={index}>
					<Icon type="crown" theme="filled" />
				</div>)
			})
		}
      </div>
    )
  }
} 
export default RateComponent;